/*
 * Copyright (c) novafaen design 2009 
 */
package tentaflykt.util;

import java.awt.Component;

import javax.swing.JOptionPane;

/**
 * Utility class for simpler use of <code>JOptionPane</code>. Contains
 * formatted dialogs in static methods.
 * @author Kristoffer Nilsson
 */
public class UserMessage {
  /**
   * Shows information dialog to the user.
   * @param parent Parent component
   * @param message Information message
   */
  public static void showInformationDialog(Component parent, String message) {
    JOptionPane.showMessageDialog(parent, message, 
        UtilRes.getString("UserMessage.Title.Error"), 
        JOptionPane.INFORMATION_MESSAGE);
  }
  
  /**
   * Shows error dialog to the user.
   * @param parent Parent component
   * @param message Error message
   */
  public static void showErrorDialog(Component parent, String message) {
    JOptionPane.showMessageDialog(parent, message, 
        UtilRes.getString("UserMessage.Title.Error"), 
        JOptionPane.ERROR_MESSAGE);
  }
  
  /**
   * Shows warning dialog to the user.
   * @param parent Parent component
   * @param message Error message
   */
  public static void showWarningDialog(Component parent, String message) {
    JOptionPane.showMessageDialog(parent, message, 
        UtilRes.getString("UserMessage.Title.Error"), 
        JOptionPane.WARNING_MESSAGE);
  }
  
  /**
   * Shows fatal error dialog to the user.
   * @param parent Parent component
   * @param message Error message
   */
  public static void showFatalDialog(Component parent, String message) {
    JOptionPane.showMessageDialog(parent, message, 
        UtilRes.getString("UserMessage.Title.Fatal"), 
        JOptionPane.ERROR_MESSAGE);
  }
}
